package com.liuceng.zen.pojo.form;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.liuceng.zen.pojo.domain.Member;

import lombok.Data;

@Data
public class RegisterForm extends BaseForm {
  //
  @NotBlank(message = "请输入账号")
  @Pattern(regexp = Member.LOGINNAME_PATTERN, message = "账号是4到20个汉字、字母、数字、下划线")
  private String loginName;

  @NotBlank(message = "请输入密码")
  @Length(min = Member.PASSWORD_MIN_LENGTH, max = Member.PASSWORD_MAX_LENGTH,
      message = "密码长度需在{min}到{max}之间")
  private String loginPassword;

  private String confirmLoginPassword;

  //
  @NotBlank(message = "请输入联系人姓名")
  @Length(min = 2, max = 10, message = "请输入合法姓名")
  private String realName;

  @Length(min = 18, max = 18, message = "身份证号为18位")
  private String identityCard;


  private Integer province;

  private Integer city;

  private Integer area;
  //

  private String phoneNum;
  private String qq;
  private String email;
  //
  @NotBlank(message = "请输入验证码")
  @Length(min = Member.VERIFYCODE_LENGTH, max = Member.VERIFYCODE_LENGTH, message = "验证码长度为{min}位")
  private String captcha;
  //
  private String useragent;
  private String referer;

  @NotNull(message = "请选择安全保护问题")
  @Min(value = 0, message = "请选择安全保护问题")
  private Integer securityQuestion;
  @NotBlank(message = "请输入您的答案")
  @Length(min = 2, max = 20, message = "请输入规范答案")
  private String securityAnswer;

  private Integer parentUserId;

  @Override
  public String toString() {
    return "SignUpForm{" + "loginName='" + loginName + '\'' + ", loginPassword='" + loginPassword
        + '\'' + ", confirmLoginPassword='" + confirmLoginPassword + '\'' + ", realName='"
        + realName + '\'' + ", identityCard='" + identityCard + '\'' + ", province=" + province
        + ", city=" + city + ", area=" + area + ", phoneNum='" + phoneNum + '\'' + ", qq='" + qq
        + '\'' + ", email='" + email + '\'' + ", captcha='" + captcha + '\'' + ", useragent='"
        + useragent + '\'' + ", referer='" + referer + '\'' + ", securityQuestion="
        + securityQuestion + ", securityAnswer='" + securityAnswer + '\'' + '}';
  }
}
